<!-- toaster directive -->
<toaster-container toaster-options="{'position-class': 'toast-top-right', 'close-button':true}"></toaster-container>
<!-- / toaster directive -->

<!-- 导航条 -->
<div class="bg-white bread-crumb">
    <ul class="breadcrumb b-a m-b-n-xs lter b-b wrapper-md">
        <li><a ui-href="main"><i class="fa fa-home"></i> 首页</a></li>
        <li class="active" ng-bind="title"></li>
        <a style="float: right;margin-right: 12%;margin-top: -10px;" 
			has-permission permission='funScenes.task.add'	ui-sref="main.funScenes.task.create" class="btn btn-sm btn-info">
			<i class="icon-tag m-r-sm text-md"></i>添加任务</a>
    </ul>
</div>

<!-- 加载提醒 -->
<div ng-show="loading" class="text-center m-t-md text-lg"><i class="fa fa-spin fa-spinner"></i> 数据加载中...</div>

<!-- 内容区域 -->
<div ng-hide="loading" class="wrapper-md content">
    <!-- 数据显示 -->
    <div class="wrapper-data">
        <div class="panel panel-default">
            <!-- 头部 -->
            <div class="panel-body">
				<form ng-submit="searchRe()" class="form-horizontal">
                   	<div class="form-group">
                   		<!--<div class="col-sm-2">
                           	<input type="text" class="form-control" placeholder="请输入任务ID" ng-model="param.id">
                       	</div>-->
                        <div class="col-sm-2">
                        <input type="text" class="form-control" placeholder="请输入任务名称" ng-model="param.taskName">
                    </div>

                        <div class="col-sm-2">
                            <input type="number" class="form-control" placeholder="请输入所属层级" ng-model="param.sort"
                                    id="sort">
                        </div>
                        <div class="col-sm-2">
                            <select class="form-control" ng-model="param.activityId"
                                    ng-options="d.id as d.activityName for d in activityList" id="activityName">
                                <option value="">--全部活动--</option>
                            </select>
                        </div>
                        <div class="col-sm-2">
                            <select class="form-control" ng-model="param.routeId"
                                    ng-options="d.id as d.routeName for d in routeList" id="routeName">
                                <option value="">--全部路线--</option>
                            </select>
                        </div>
                        <div class="col-sm-2">
                            <select class="form-control" ng-model="param.taskStatus"
                                     id="taskStatus">
                                <option value="">--所有任务--</option>
                                <option value="1">--新任务--</option>
                                <option value="2">--使用中--</option>
                            </select>
                        </div>

                   	</div>
                    <div class="form-group">
                        <div class="col-sm-10">
                            <label class="col-sm-1"><button class="ifc-btn btn-primary" type="submit">查 询</button></label>

                            <label class="col-sm-1"><button class="ifc-btn btn-dark" type="button" ng-click="clearSearch()">重  置</button></label>
                        </div>

                        <!--<div class="col-sm-2">
                            <select class="form-control" ng-model="param.costTime"
                                    id="costTime">
                                <option value="">&#45;&#45;全部时间&#45;&#45;</option>
                                <option value="30">30</option>
                                <option value="60">60</option>
                                <option value="90">90</option>
                                <option value="120">120</option>
                            </select>
                        </div>-->


                    </div>
				</form>
            </div>

            <!-- 数据表格 -->
            <div class="table-responsive">
                <table class="table table-striped b-t b-light text-center">
                    <thead>
                    <tr>
                    	<!-- <th><input type="checkbox" ng-click="selectAll($event)"/>全选</th> -->
                        <th>序号</th>
                        <th>任务ID</th>
                        <th>任务名称</th>
                        <th>时间限制</th>
                        <th>层级</th>
                        <th>所属活动</th>
                        <th>所属路线</th>
                        <th>状态</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    <tr ng-repeat="item in pageInfo.records">
                    	<!-- <td class="v-middle"><input type="checkbox" name="selected" ng-checked="isSelected(item.id)" ng-click="updateSelection($event,item)"/></td> -->
                        <td class="v-middle">{{$index + 1}}</td>
                        <td class="v-middle">{{item.taskId}}</td>
                        <td class="v-middle" title="{{item.taskName}}">{{item.taskName | limitTo:10}}</td>
                        <td class="v-middle">{{item.costTime}}</td>
                        <td class="v-middle">
                            <span ng-if="item.sort==1" >首发任务</span>
                            <span ng-if="item.sort!=1">{{item.sort}}</span>
                            </td>
                        
                        <td class="v-middle">{{item.activityName}}</td>

                        <td class="v-middle">
                            {{item.routeName}}
                        </td>
                        <td class="v-middle">
                            <span ng-if="item.taskStatus==1">新任务</span>
                            <span ng-if="item.taskStatus==2 ||item.taskStatus==0">使用中</span>
                        </td>
                        <td class="v-middle">
                        	<a ui-sref="main.funScenes.task.detail({id:item.taskId})"-  class="btn btn-sm btn-default">
                                <i class="fa fa-edit m-r-xs text-sm"></i>详情</a>
                            <a ng-if="item.taskStatus==1 || item.taskStatus==2 " ui-sref="main.funScenes.task.update({id:item.taskId})"-  class="btn btn-sm btn-default">
                                <i class="fa fa-edit m-r-xs text-sm"></i>修改</a>
                            <a ng-if="item.taskStatus==1" ng-click="delTask(item.taskId,item.taskStatus)"   class="btn btn-sm btn-default">
                                <i class="fa fa-edit m-r-xs text-sm"></i>删除</a>
                        </td>
                    </tr>
                    </tbody>
                </table>
            </div><!-- /.table-responsive -->
            <!-- 底部分页 -->
			<span data-ng-include=" 'src/tpl/pageInfo.html' "></span>
        </div><!-- /.panel -->
    </div><!-- /.wrapper-data -->
</div><!-- /.wrapper-md -->